package com.study.util;

public class DynamicDataSourceHolder {
	
	private static final ThreadLocal<DynamicDataSourceType> HOLDER = new ThreadLocal<>();
	
	public static void setDataSource(DynamicDataSourceType type) {
		if (null == type) {
			HOLDER.set(DynamicDataSourceType.DS1);
		} else {
			HOLDER.set(type);
		}
	}
	
	public static DynamicDataSourceType getDataSource() {
		DynamicDataSourceType type = HOLDER.get();
		return type;
	}

}
